using IcsSEMCtrl.Db;
using IcsSEMCtrl.Global.Exception;
using IcsSEMCtrl.Interfaces.Service;
using System;
using System.Collections.Generic;
namespace IcsSEMCtrl.Service
{
	public abstract class AbstractManager : Persistence, IManager
	{
		private static Dictionary<string, Dictionary<string, AbstractManager>> managerMap;
		protected string ownerId = string.Empty;
		private string managerId = string.Empty;
		public string ManagerId
		{
			get
			{
				return this.managerId;
			}
		}
		static AbstractManager()
		{
			AbstractManager.managerMap = new Dictionary<string, Dictionary<string, AbstractManager>>();
		}
		public AbstractManager(string ownerId, string managerId)
		{
			this.ownerId = ownerId;
			this.managerId = managerId;
			Dictionary<string, AbstractManager> dictionary;
			if (!AbstractManager.managerMap.ContainsKey(ownerId))
			{
				dictionary = new Dictionary<string, AbstractManager>();
				AbstractManager.managerMap.Add(ownerId, dictionary);
			}
			else
			{
				dictionary = AbstractManager.managerMap[ownerId];
			}
            if (!dictionary.ContainsKey(managerId))
            {
                dictionary.Add(managerId, this);
            }
		}
	}
}
